var mongoose =require('mongoose')
var url='mongodb://localhost:27017/data-analysis'

mongoose.connect(url)

mongoose.connection.on('connected',()=>{
    console.log('MongoDB成功连接'+url)
})
mongoose.connection.on('error',function (err) {    
    console.log('MongoDB连接异常: ' + err);  
})
mongoose.connection.on('disconnected', function () {    
    console.log('MongoDB连接断开');  
})


module.exports=mongoose